package com.css.fxfzaqbz.modules.data.controller;

import com.css.fxfzaqbz.modules.data.repository.ImportantActivityRepository;
import com.css.fxfzaqbz.util.PlatformDateUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;
import java.util.Date;

@Configuration      //1.主要用于标记配置类，兼备Component的效果。
@EnableScheduling   // 2.开启定时任务
public class TimedTask {
    @Resource
    ImportantActivityRepository importantActivityRepository;

    //3.添加定时任务 每天凌晨 0点 执行
    @Scheduled(cron = "0 0 0 * * ?")
    private void configureTasks() {
        importantActivityRepository.timedUpdateOpinionStatus();
    }
}
